package edu.pku.sei.transformation.util.parser.texttemplate.element;

import edu.pku.sei.transformation.editor.model.variable.ConnectionVariable;

public class ElementEdge extends ConnectionVariable implements Comparable {
	private int weight = 1;

	public TextElement getSourceTextElement() {
		return (TextElement) source;
	}

	// public void setSource(TextElement source) {
	// this.source = source;
	// }

	public TextElement getTargetTextElement() {
		return (TextElement) target;
	}

	// public void setTarget(TextElement to) {
	// this.target = to;
	// }
	public int getWeight() {
		return weight;
	}

	public void setWeight(int weight) {
		this.weight = weight;
	}

	@Override
	public String toString() {
		return weight + "." + target.getName();
	}

	@Override
	public int compareTo(Object arg0) {
		if (arg0 instanceof ElementEdge)
			return this.weight - ((ElementEdge) arg0).getWeight();
		else
			return 0;
	}
}
